<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wechat_department', function (Blueprint $table) {
            $table->id();
            $table->integer('department_id')->default(0)->comment('部门ID');
            $table->string('corp_id', 100)->default('')->comment('企业ID');
            $table->integer('parent_id')->default(0)->comment('上级部门ID');
            $table->string('department_name', 50)->default('')->comment('部门名称');
            $table->integer('order')->default(0)->comment('部门排序');
            $table->timestamps();
        });


        Schema::create('wechat_account', function (Blueprint $table) {
            $table->id();
            $table->string('user_id', 50)->default('')->comment('用户ID');
            $table->string('corp_id', 100)->default('')->comment('企业ID');
            $table->string('department_id', 50)->default('')->comment('部门ID');
            $table->string('user_name', 100)->default('')->comment('用户名称');
            $table->string('open_userid', 100)->default('')->comment('open id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wechat_department');
        Schema::dropIfExists('wechat_account');
    }
};
